<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="bean.Category" %>
<!DOCTYPE html>
<html>
<head>
    <title>修改分类</title>
    <style>
        .container {
            max-width: 600px;
            margin: 50px auto;
            padding: 20px;
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        label {
            display: block;
            margin-bottom: 5px;
            font-weight: bold;
        }
        
        input[type="text"], textarea {
            width: 100%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
        }
        
        .buttons {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
        }
        
        button {
            padding: 8px 16px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        
        .save-btn {
            background-color: #4CAF50;
            color: white;
        }
        
        .cancel-btn {
            background-color: #f44336;
            color: white;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>修改分类</h2>
        
        <% if(request.getAttribute("error") != null) { %>
            <div class="error-message">
                <%= request.getAttribute("error") %>
            </div>
        <% } %>
        
        <form action="editCategory" method="POST">
            <input type="hidden" name="action" value="updateCategory">
            <input type="hidden" name="categoryId" value="${category.id}">
            
            <div class="form-group">
                <label for="name">分类名称：</label>
                <input type="text" id="name" name="name" value="${category.name}" required>
            </div>
            
            <div class="form-group">
                <label for="description">分类描述：</label>
                <textarea id="description" name="description" rows="4">${category.description}</textarea>
            </div>
            
            <div class="buttons">
                <button type="button" class="cancel-btn" onclick="window.history.back()">取消</button>
                <button type="submit" class="save-btn">保存</button>
            </div>
        </form>
    </div>
</body>
</html> 